<!-- This file represents a Lasso processing file that determines what to actually display. It does not contain any HTML but simply determines how to display the included file, and depends upon the actions that occurred before the file is processed.
The expenses list is edited directly through a portal. To delete a portal row, the related database must include a unique field or serial number to identify that specific record (a field value that is in addition to the hidden record id value).
A conditional is used to determine if a change has occurred to the contents of the portal rows. In this case, if the previous action was a search on the "Employees_Related.fp3" database then some change has occurred to the portal. The element "database_name" is a Lasso substitution tag that will be substituted with the value of the database specified in the action that was used to invoke this page. View the "expense_include.html" file for details.
If the last action was not a search then the else is referenced, in this case it is an include that displays the "expense_include.html" format file, which contains the portal.
If the format file was processed after a search of the related database has occurred, the inline action will delete a record in the related database. This works since this is the only case in which "Employees_Related.fp3" is searched prior to this page being processed. The database_name tag is used to automatically substitute in the name of the database that the search was performed on, in this case "employees_related."
The delete is accomplished by first searching the related "employees_related" database for the "expense_id" field to identify the record to be deleted and this page acts as the reply page of that search. See the "expense_include.html" file for details.
<!-- The second, inline action occurs to search the employees database and find the changed contents of the portal. This is accomplish using a token that was set previously to the value of the "employee_id" field. The "employee_id" field is the unique serial number field used to identify the record. It is used in lieu of the actual record id (which is not available when switching between related databases). -->
<!-- A second, nested, inline action is used to "force" FileMaker to update the values in the portal. The second search is not needed, however, if not used, the delete may need to be selected twice. A new token is set for the text on the reply to indicate a row had been deleted. -->